﻿<PropertyPanels:GadgetPropertiesPanelBase x:Class="EpiDashboard.Controls.GadgetProperties.LogisticProperties"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:Controls="clr-namespace:EpiDashboard.Controls"
             xmlns:PropertyPanels="clr-namespace:EpiDashboard.Controls.GadgetProperties"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="800" Loaded="UserControl_Loaded" Style="{DynamicResource PropertiesPanelStyle}">
    <PropertyPanels:GadgetPropertiesPanelBase.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../../StyleDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </PropertyPanels:GadgetPropertiesPanelBase.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition MaxWidth="400" MinWidth="300" Width=".33*" />
            <ColumnDefinition Width="30" />
            <ColumnDefinition MinWidth="275" Width=".66*" />
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <StackPanel Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="0"  Background="{StaticResource PrimaryAccentColorLight}" >
            <Border BorderBrush="#015796" BorderThickness="0 0 0 1">
                <Viewbox StretchDirection="DownOnly" Stretch="Uniform" HorizontalAlignment="Left">
                    <Label x:Name="lblConfigExpandedTitle" FontWeight="Light" Foreground="White" FontSize="56" Margin="0, 0, 0, 10">
                        <TextBlock TextWrapping="Wrap" x:Name="lblConfigExpandedTitleTxt">Logistic Regression</TextBlock>
                    </Label>
                </Viewbox>
            </Border>
        </StackPanel>
        <StackPanel Grid.Column="0" Grid.RowSpan="2" Grid.Row="1" x:Name="panelSidebar" Background="{StaticResource PrimaryAccentColorLight}">
            <Controls:SettingsToggleButton x:Name="tbtnVariables" Title="Variables" Description="Select columns to display in the list." IsChecked="True" Checked="tbtnVariables_Checked"/>
            <!--<Controls:SettingsToggleButton x:Name="tbtnSorting" Title="Sorting and Grouping" Description="Set a sort order and create list groups." IsChecked="False" Checked="tbtnSorting_Checked"/>-->
            <Controls:SettingsToggleButton x:Name="tbtnDisplay" Title="Display" Description="Change display options." IsChecked="False" Checked="tbtnDisplay_Checked"/>
            <Controls:SettingsToggleButton x:Name="tbtnFilters" Title="Filters" Description="Set data filters for this gadget." IsChecked="False" Checked="tbtnFilters_Checked"/>
        </StackPanel>

        <DockPanel x:Name="panelVariables" Grid.Column="2" Grid.Row="1" Margin="0, 0, 10, 0" Visibility="Visible">
            <StackPanel DockPanel.Dock="Top">
                <Label x:Name="tblockPanelVariables" Style="{StaticResource PropertiesHeading}" Margin="0, 0, 0, 10">
                    <TextBlock TextWrapping="Wrap" x:Name="tblockPanelVariablesTxt">Variables</TextBlock>
                </Label>
            </StackPanel>

            <ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto" DockPanel.Dock="Bottom">
                <StackPanel>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="0.5*" />
                            <ColumnDefinition Width="0.5*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Label x:Name="tblockOutcomeVariable" Grid.Column="0" Grid.Row="0">
                            <TextBlock TextWrapping="Wrap" x:Name="tblockOutcomeVariableTxt">Outcome:</TextBlock>
                        </Label>
                        <!--ComboBox x:Name="cbxField" Width="216" HorizontalAlignment="Left" Height="28" /-->
                        <ComboBox Grid.Column="0" Grid.Row="1" x:Name="cbxFieldOutcome" Width="216" HorizontalAlignment="Left" Height="28" />
                        <Label x:Name="tblockWeightVariable" Grid.Column="2" Grid.Row="0">
                            <TextBlock TextWrapping="Wrap" x:Name="tblockWeightVariableTxt">Weight:</TextBlock>
                        </Label>
                        <ComboBox Grid.Column="2" Grid.Row="1" x:Name="cbxFieldWeight" Width="216" HorizontalAlignment="Left" Height="28" />
                        <Label x:Name="tblockIndependentVariables" Grid.Column="0" Grid.Row="2">
                            <TextBlock TextWrapping="Wrap" x:Name="tblockIndependentVariablesTxt">Independent Variables:</TextBlock>
                        </Label>
                        <ComboBox Grid.Column="0" Grid.Row="3" x:Name="cbxFields" Width="216" HorizontalAlignment="Left" Height="28" SelectionChanged="cbxFields_SelectionChanged" />
                        <!--ListBox SelectionMode="Multiple" Name="lvFieldStrata" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MaxHeight="90" /-->
                        <ListBox Grid.Column="0" Grid.Row="4" SelectionMode="Extended" Name="lbxOtherFields" HorizontalAlignment="Left" VerticalAlignment="Stretch" Height="90" Width="216" SelectionChanged="lbxOtherFields_SelectionChanged" MouseDoubleClick="lbxOtherFields_MouseDoubleClick" />
                        <Grid Grid.Row="4" Grid.Column="1">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="1*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Button x:Name="btnMakeDummy" Grid.Row="0" HorizontalAlignment="Left" Width="auto" Grid.Column="0" Click="btnMakeDummy_Click">
                                <TextBlock TextWrapping="Wrap" x:Name="btnMakeDummyTxt">Make Dummy</TextBlock>
                            </Button>
                            <Label Height="5" Grid.Row="1" Grid.Column="0" />
                            <Button x:Name="btnClearInteractionTerms" Grid.Row="2" Grid.Column="0" Width="auto" HorizontalAlignment="Left" Click="btnClearInteractionTerms_Click">
                                <TextBlock TextWrapping="Wrap" x:Name="btnClearInteractionTermsTxt">Clear Terms</TextBlock>
                            </Button>
                        </Grid>
                        <!--<ListView Name="lvFieldStrata" MaxHeight="450">
                <ListView.View>
                    <GridView>
                        <GridViewColumn Header="Name" Width="Auto" DisplayMemberBinding="{Binding Name}" />
                        <GridViewColumn Header="Data Type" Width="Auto" DisplayMemberBinding="{Binding DataType}" />
                    </GridView>
                </ListView.View>
                <ListView.GroupStyle>
                    <GroupStyle>
                        <GroupStyle.HeaderTemplate>
                            <DataTemplate>
                                <TextBlock FontWeight="Bold" FontSize="14" Text="{Binding Name}"/>
                            </DataTemplate>
                        </GroupStyle.HeaderTemplate>
                    </GroupStyle>
                </ListView.GroupStyle>
            </ListView>-->
                        <Label x:Name="tblockMatchVariable" Grid.Column="0" Grid.Row="5">
                            <TextBlock TextWrapping="Wrap" x:Name="tblockMatchVariableTxt">Match Variable:</TextBlock>
                        </Label>
                        <!--ComboBox x:Name="cbxFieldCrosstab" Width="216" HorizontalAlignment="Left" Height="28" /-->
                        <ComboBox Grid.Column="0" Grid.Row="6" x:Name="cbxFieldMatch" Width="216" HorizontalAlignment="Left" Height="28" />
                        <CheckBox x:Name="checkboxShowANOVA" IsChecked="True" Margin="0,8,0,0" Visibility="Collapsed">
                            <TextBlock TextWrapping="Wrap" x:Name="checkboxShowANOVATxt">Display ANOVA statistics</TextBlock>
                        </CheckBox>

                        <Label x:Name="tblockConfidenceLimits" Grid.Column="2" Grid.Row="5">
                            <TextBlock TextWrapping="Wrap" x:Name="tblockConfidenceLimitsTxt">Confidence Limits:</TextBlock>
                        </Label>
                        <ComboBox Grid.Column="2" Grid.Row="6" x:Name="cbxConf" Width="216" HorizontalAlignment="Left" Height="28" />
                        <TextBlock x:Name="tblockDummyVariables" TextWrapping="Wrap" Grid.Column="0" Grid.Row="7" HorizontalAlignment="Left" TextAlignment="Left" Text="Dummy variables:" Margin="0,5,0,0" />
                        <ListBox Height="40" Grid.Column="0" Grid.Row="8" x:Name="lbxDummyTerms" HorizontalAlignment="Left" SelectedIndex="0" Width="160"  Margin="0,5,0,0" Grid.RowSpan="1" SelectionMode="Single" MouseDoubleClick="lbxDummyTerms_MouseDoubleClick" />
                        <TextBlock x:Name="tblockInteractionTerms" TextWrapping="Wrap" Grid.Column="2" Grid.Row="7" HorizontalAlignment="Left" TextAlignment="Left" Text="Interaction terms:" Margin="0,5,0,0" />
                        <ListBox Height="40" Grid.Column="2" Grid.Row="8" x:Name="lbxInteractionTerms" HorizontalAlignment="Left" SelectedIndex="0" Width="160"  Margin="0,5,0,0" Grid.RowSpan="1" SelectionMode="Single" MouseDoubleClick="lbxInteractionTerms_MouseDoubleClick" />
                        
                        <CheckBox Grid.Column="0" Grid.Row="9" x:Name="checkboxNoIntercept" HorizontalAlignment="left">
                            <TextBlock TextWrapping="Wrap" x:Name="checkboxNoInterceptTxt">No intercept</TextBlock>
                        </CheckBox>
                        <CheckBox Grid.Column="2" Grid.Row="9" x:Name="checkboxIncludeMissing" HorizontalAlignment="left">
                            <TextBlock TextWrapping="Wrap" x:Name="checkboxIncludeMissingTxt">Include missing</TextBlock>
                        </CheckBox>
                    </Grid>
                </StackPanel>
            </ScrollViewer>
        </DockPanel>

        <DockPanel x:Name="panelSorting" Grid.Column="2" Grid.Row="1" Margin="0, 0, 10, 0" Visibility="Collapsed">
            <StackPanel DockPanel.Dock="Top">
                <Label x:Name="tblockPanelSorting" Style="{StaticResource PropertiesHeading}" Margin="0, 0, 0, 10">
                    <TextBlock TextWrapping="Wrap" x:Name="tblockPanelSortingTxt">Sorting and Grouping</TextBlock>
                </Label>
            </StackPanel>

            <ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto" DockPanel.Dock="Bottom" x:Name="scrollViewerProperties">
                <StackPanel>
                    <Label x:Name="tblockGroupingSubheader" Style="{StaticResource PropertiesSubHeading}" Margin="0, 0, 0, 5">
                        <TextBlock TextWrapping="Wrap" x:Name="tblockGroupingSubheaderTxt">Grouping</TextBlock>
                    </Label>
                    <Label x:Name="tblockGroupby">
                        <TextBlock TextWrapping="Wrap" x:Name="tblockGroupbyTxt">Group By:</TextBlock>
                    </Label>
                    <ComboBox x:Name="cmbGroupField" Width="{Binding ElementName=lbxAvailableVariables, Path=ActualWidth}" HorizontalAlignment="Left"/>

                    <Label x:Name="tblockSubGroupBy">
                        <TextBlock TextWrapping="Wrap" x:Name="tblockSubGroupByTxt">Sub-group By:</TextBlock>
                    </Label>
                    <ComboBox x:Name="cmbSecondaryGroupField" Width="{Binding ElementName=lbxAvailableVariables, Path=ActualWidth}" HorizontalAlignment="Left"/>

                    <Label x:Name="tblockSortingSubheader" Style="{StaticResource PropertiesSubHeading}" Margin="0, 26, 0, 5">
                        <TextBlock TextWrapping="Wrap" x:Name="tblockSortingSubheaderTxt">Sorting</TextBlock>
                    </Label>

                    <Label x:Name="tblockSortMethod">
                        <TextBlock TextWrapping="Wrap" x:Name="tblockSortMethodTxt">Sort Method:</TextBlock>
                    </Label>
                    <ComboBox x:Name="cmbSortMethod" Width="{Binding ElementName=lbxAvailableVariables, Path=ActualWidth}" HorizontalAlignment="Left" SelectedIndex="0" Margin="0, 0, 0, 8">
                        <ComboBoxItem>Ascending</ComboBoxItem>
                        <ComboBoxItem>Descending</ComboBoxItem>
                    </ComboBox>

                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width=".5*" />
                            <ColumnDefinition Width="10" />
                            <ColumnDefinition Width=".5*" />
                        </Grid.ColumnDefinitions>
                        <StackPanel Grid.Column="0">
                            <Label x:Name="tblockAvailableVariables">
                                <TextBlock TextWrapping="Wrap" x:Name="tblockAvailableVariablesTxt">Available Variables:</TextBlock>
                            </Label>
                            <ListBox x:Name="lbxAvailableVariables" Height="370" MouseDoubleClick="lbxAvailableVariables_MouseDoubleClick" />
                        </StackPanel>

                        <StackPanel Grid.Column="2">
                            <Label x:Name="tblockSortOrder">
                                <TextBlock TextWrapping="Wrap" x:Name="tblockSortOrderTxt">Sort Order:</TextBlock>
                            </Label>
                            <ListBox x:Name="lbxSortOrder" Height="370" MouseDoubleClick="lbxSortOrder_MouseDoubleClick" />
                        </StackPanel>
                    </Grid>
                </StackPanel>
            </ScrollViewer>
        </DockPanel>

        <DockPanel x:Name="panelDisplay" Grid.Column="2" Grid.Row="1" Margin="0, 0, 10, 0" Visibility="Collapsed">
            <StackPanel DockPanel.Dock="Top">
                <Label x:Name="tblockPanelDisplay" Style="{StaticResource PropertiesHeading}" Margin="0, 0, 0, 10">
                    <TextBlock TextWrapping="Wrap" x:Name="tblockPanelDisplayTxt">Display</TextBlock>
                </Label>
            </StackPanel>

            <ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto" DockPanel.Dock="Bottom" x:Name="scrollViewerDisplay">
                <StackPanel>
                    <Label x:Name="tblockTitleNDescSubheader" Style="{StaticResource PropertiesSubHeading}" Margin="0,0, 0, 5">
                        <TextBlock TextWrapping="Wrap" x:Name="tblockTitleNDescSubheaderTxt">Title and Description</TextBlock>
                    </Label>
                    <StackPanel Orientation="Vertical">
                        <StackPanel>
                            <Label x:Name="tblockTitle" VerticalAlignment="Bottom" HorizontalAlignment="Left">
                                <TextBlock TextWrapping="Wrap" x:Name="tblockTitleTxt">Gadget title:</TextBlock>
                            </Label>

                            <TextBox x:Name="txtTitle" AcceptsReturn="True" TextWrapping="Wrap" Style="{StaticResource PropertiesGadgetTitle}" HorizontalAlignment="Left"></TextBox>
                        </StackPanel>
                        <StackPanel Margin="0 10 0 0">
                            <Label x:Name="tblockDesc" VerticalAlignment="Bottom" HorizontalAlignment="Left">
                                <TextBlock TextWrapping="Wrap" x:Name="tblockDescTxt">Gadget description:</TextBlock>
                            </Label>
                        <TextBox x:Name="txtDesc" Style="{StaticResource PropertiesGadgetDescription}" TextWrapping="Wrap" AcceptsReturn="True" HorizontalAlignment="Left"></TextBox>
                        </StackPanel>
                    </StackPanel>
                    <!--<Label x:Name="tblockMaxWidth" VerticalAlignment="Bottom" HorizontalAlignment="Left" Content="Max width:" Margin="0,5,0,0"  />
            <TextBox x:Name="txtMaxWidth" Width="40" HorizontalAlignment="Left" Text="800" PreviewKeyDown="txtInput_PositiveIntegerOnly_PreviewKeyDown"></TextBox>
            
            <Label x:Name="tblockMaxHeight" VerticalAlignment="Bottom" HorizontalAlignment="Left" Content="Max height:" Margin="0,5,0,0"  />
            <TextBox x:Name="txtMaxHeight" Width="40" HorizontalAlignment="Left" Text="500" PreviewKeyDown="txtInput_PositiveIntegerOnly_PreviewKeyDown"></TextBox>-->

                    <!--<CheckBox x:Name="checkboxTabOrder" Style="{StaticResource PropertiesPanelCheckbox}" Content="Sort variables by tab order" Visibility="Visible" IsEnabled="true" />
            <CheckBox x:Name="checkboxUsePrompts" Style="{StaticResource PropertiesPanelCheckbox}" Content="Use field prompts" Visibility="Visible" IsEnabled="true" />-->
                    <CheckBox x:Name="checkboxListLabels" Visibility="Collapsed" Style="{StaticResource PropertiesPanelCheckbox}" IsEnabled="true">
                        <TextBlock TextWrapping="Wrap" x:Name="checkboxListLabelsTxt">Display list labels</TextBlock>
                    </CheckBox>
                    <CheckBox x:Name="checkboxLineColumn" Visibility="Collapsed" Style="{StaticResource PropertiesPanelCheckbox}" IsChecked="True">
                        <TextBlock TextWrapping="Wrap" x:Name="checkboxLineColumnTxt">Show line column</TextBlock>
                    </CheckBox>
                    <CheckBox x:Name="checkboxColumnHeaders" Visibility="Collapsed" Style="{StaticResource PropertiesPanelCheckbox}" IsChecked="True">
                        <TextBlock TextWrapping="Wrap" x:Name="checkboxColumnHeadersTxt">Show column headings</TextBlock>
                    </CheckBox>
                    <CheckBox x:Name="checkboxShowNulls" Visibility="Collapsed" Style="{StaticResource PropertiesPanelCheckbox}" IsChecked="True">
                        <TextBlock TextWrapping="Wrap" x:Name="checkboxShowNullsTxt">Show missing representation</TextBlock>
                    </CheckBox>
                    <TextBlock x:Name="tblockPrecision" TextWrapping="Wrap" Visibility="Collapsed" HorizontalAlignment="Left" TextAlignment="Left" Text="Decimals to display:" Margin="0,5,0,0"  />
                    <ComboBox x:Name="cbxFieldPrecision" Visibility="Collapsed" HorizontalAlignment="Left" Width="45" SelectedIndex="5">
                        <ComboBoxItem>0</ComboBoxItem>
                        <ComboBoxItem>1</ComboBoxItem>
                        <ComboBoxItem>2</ComboBoxItem>
                        <ComboBoxItem>3</ComboBoxItem>
                        <ComboBoxItem>4</ComboBoxItem>
                    </ComboBox>
                    <TextBlock x:Name="tblockOutputColumns" TextWrapping="Wrap" Visibility="Collapsed" Margin="0,26,0,5" >Output columns to display:</TextBlock>
                    <ListBox x:Name="lbxColumns" Visibility="Collapsed" SelectionMode="Multiple" SelectionChanged="lbxColumns_SelectionChanged" />
                    <!--<CheckBox x:Name="checkboxAllowUpdates" Style="{StaticResource PropertiesPanelCheckbox}" Content="Allow updates" Visibility="Collapsed" IsEnabled="true" />-->

                </StackPanel>
            </ScrollViewer>
        </DockPanel>

        <DockPanel  x:Name="panelFilters" Grid.Column="2" Grid.Row="1" Margin="0, 0, 10, 0" Visibility="Collapsed">
            <StackPanel DockPanel.Dock="Top">
                <Label x:Name="tblockPanelDataFilter" Style="{StaticResource PropertiesHeading}" Margin="0, 0, 0, 10">
                    <TextBlock TextWrapping="Wrap" x:Name="tblockPanelDataFilterTxt">Data Filters</TextBlock>
                </Label>
                <Label x:Name="tblockAnyFilterGadgetOnly">
                    <TextBlock TextWrapping="Wrap" x:Name="tblockAnyFilterGadgetOnlyTxt">Note: Any filters set here are applied to this gadget only.</TextBlock>
                </Label>
            </StackPanel>
        </DockPanel>

        <Button Style="{StaticResource CloseButtonStyle}" Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="8" Click="CloseButton_Click" />

        <DockPanel Grid.ColumnSpan="3" Grid.Row="2">
            <Button x:Name="btnCancel" DockPanel.Dock="Right" HorizontalAlignment="Right" Margin="8" Width="134" Height="42" Click="btnCancel_Click">
                <TextBlock TextWrapping="Wrap" x:Name="btnCancelTxt">Cancel</TextBlock>
            </Button>
            <Button x:Name="btnRun" DockPanel.Dock="Right" HorizontalAlignment="Right" Margin="8" Width="134" Height="42" Click="btnRun_Click">
                <TextBlock TextWrapping="Wrap" x:Name="btnRunTxt">OK</TextBlock>
            </Button>
        </DockPanel>
    </Grid>
</PropertyPanels:GadgetPropertiesPanelBase>
